<template>
  <div>
    <pulldown header="平均签到率">
      <div slot="content">
        <a-descriptions layout="vertical" :column="4" bordered>
          <a-descriptions-item label="近一年平均签到率">
            <a-progress type="circle" :percent="resultData.lastYear ? resultData.lastYear:0" :format="percent => `${percent} %`" />
          </a-descriptions-item>
          <a-descriptions-item label="近半年平均签到率">
            <a-progress type="circle" :percent="resultData.lastHalfYear ? resultData.lastHalfYear:0" :format="percent => `${percent} %`" />
          </a-descriptions-item>
          <a-descriptions-item label="近一季度平均签到率">
            <a-progress type="circle" :percent="resultData.lastQuarter?resultData.lastQuarter:0" :format="percent => `${percent} %`" />
          </a-descriptions-item>
          <a-descriptions-item label="近一月平均签到率">
            <a-progress type="circle" :percent="resultData.lastMother?resultData.lastMother:0" :format="percent => `${percent} %`" />
          </a-descriptions-item>
        </a-descriptions>
      </div>
    </pulldown>
    <pulldown header="漏签记录">
      <div slot="content">
        <a-table :columns="columns" :data-source="pageData">

        </a-table>
      </div>
    </pulldown>
    <!--    {{$filterDictTextByCache('process_approval_type', 1)}}-->
  </div>
</template>

<script>
import pulldown from '../../../modules/pulldown'
import { personMissSignCount, signRateCount} from "@api/sjsk/archives";
export default {
  name: "basic",
  components:{ pulldown },
  mounted() {
  },
  data(){
    return   {
      resultData:{},
      innse:true,
      user:{
        sjskCode:this.$store.state.holographicArchives.routeObjData.sjskCode,
      },
      forList:[
        {name:'证件类型',key:'certificateType',val:'2022.07.14'},
        {name:'证件号码',key:'identityCard',val:'张三'},
        {name:'出生日期',key:'birthday',val:'女'},
        {name:'姓名',key:'realName',val:'2022.07.14'},
      ],
      loading: false,
      columns: [
        {
          title: '序号',
          dataIndex: 'order',
          width: 60,
          align: 'center',
        },
        {
          title: '日期',
          dataIndex: 'name',
          width: 60,
          align: 'center',
          customRender: text => {
            return <j-ellipsis value={text} length={14} />
          }
        },
        {
          title: '签到情况',
          dataIndex: 'loginStatus',
          width: 80,
          align: 'center'
        }
      ],
      pageFilter: {
        pageNo: 1,
        pageSize: 10
      },
      pageData:[]
    }
  },
  methods:{
    getbasicDetail(){
      // personMissSignCount().then(ser => {
      //   if(ser.success){
      //     console.log(ser)
      //     this.pageData = ser.result.content
      //     let order = 0
      //     for(let item of this.pageData){
      //       order++
      //       item.order = order
      //     }
      //   }
      // }).catch(err =>{
      //
      // })

    },
    refreshTable(){
      console.log('签到检查')
      this.getbasicDetail()
      signRateCount({caseNo:this.user.sjskCode}).then(ser => {
        console.log(ser)
        if(ser.success){
          this.pageData = ser.result
          console.log(this.pageData)
          console.log(6)
        }
      }).catch(err => {

      })
    },
    onSelectedRow(keys) {
      this.selectKeys = keys
      this.isDisabled = keys.length <= 0
    },
    onTableChange(pagination, pageFilter, sorter) {
      let keyMap = { currentPage: 'pageNo' }
      let paginations = Object.keys(pagination).reduce((newData, key) => {
        let newKey = keyMap[key] || key
        newData[newKey] = pagination[key]
        return newData
      }, {})
      this.pageFilter = Object.assign({}, this.pageFilter, paginations)
      this.refreshTable()
    },
  }
}
</script>

<style scoped>
/deep/ th {
  text-align: center!important;
}
/deep/ td>*{
  display: flex;
  justify-content: center;
}
</style>